﻿using System.ComponentModel;
using System.IO;
using FarmerJoe.ClassSettings;
using Styx;
using Styx.Helpers;

using DefaultValue = Styx.Helpers.DefaultValueAttribute;

namespace FarmerJoe.Settings
{
    internal class FpswareSettings : Styx.Helpers.Settings
    {
        private static FpswareSettings _instance;

        public FpswareSettings() : base(Path.Combine(CharacterSettingsPath, "FpswareSettings.xml")) { }

        private static string CharacterSettingsPath
        {
            get
            {
                string settingsDirectory = Path.Combine(Styx.Common.Utilities.AssemblyDirectory, "Settings");
                return Path.Combine(Path.Combine(settingsDirectory, StyxWoW.Me.RealmName), StyxWoW.Me.Name);
            }
        }

        public static string SettingsPath
        {
            get
            {
                string settingsDirectory = Path.Combine(Styx.Common.Utilities.AssemblyDirectory, "Settings");
                return Path.Combine(Path.Combine(Path.Combine(settingsDirectory, StyxWoW.Me.RealmName), StyxWoW.Me.Name), "Fpsware");
            }
        }

        public static FpswareSettings Instance { get { return _instance ?? (_instance = new FpswareSettings()); } }


        #region Category: General

        [Setting]
        [DefaultValue(false)]
        [Category("Movement")]
        [DisplayName("Disable Movement")]
        [Description("Disable all movement within the CC. This will NOT stop it from charging, blinking, etc. Only moving towards units, and facing will be disabled.")]
        public bool DisableAllMovement { get; set; }


        #endregion


        #region Class Late-Loading Wrappers


        private DruidSettings _druidSettings;
        private PriestSettings _priestSettings;
        private WarlockSettings _warlockSettings;
        private HunterSettings _hunterSettings;

        [Browsable(false)]
        public DruidSettings Druid { get { return _druidSettings ?? (_druidSettings = new DruidSettings()); } }

        [Browsable(false)]
        public HunterSettings Hunter { get { return _hunterSettings ?? (_hunterSettings = new HunterSettings()); } }

        [Browsable(false)]
        public PriestSettings Priest { get { return _priestSettings ?? (_priestSettings = new PriestSettings()); } }

        [Browsable(false)]
        public WarlockSettings Warlock { get { return _warlockSettings ?? (_warlockSettings = new WarlockSettings()); } }

        #endregion
    }
}